﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class findhoadon : System.Web.UI.Page
{
    datasever data;
    SqlConnection conn;
    SqlCommand cmd;
    SqlDataAdapter da;
    DataSet ds;
    protected void Page_Load(object sender, EventArgs e)
    {
        gv.RowDataBound += new GridViewRowEventHandler(gv_RowDataBound);
        data = new datasever();
        conn = data.getconnect();
        cmd = new SqlCommand("sp_tbl_hoa_don_select", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new SqlParameter("@Hoa_don_id", hoaDon.Text));
        da = new SqlDataAdapter(cmd);
        ds = new DataSet();
        da.Fill(ds, "Hoa_don");
        gv.DataSource = ds.Tables["Hoa_don"];
        gv.DataBind();
    }

    void gv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string HyperLinkValue = e.Row.Cells[0].Text;
            HyperLink myLink = new HyperLink();
            myLink.NavigateUrl = "default3.aspx?Hoa_don_id=" + HyperLinkValue;
            myLink.Text = HyperLinkValue;
            e.Row.Cells[0].Controls.Add(myLink);
        }
    }

   
    protected void hoaDon_TextChanged(object sender, EventArgs e)
    {
        data = new datasever();
        conn = data.getconnect();
        cmd = new SqlCommand("sp_tbl_hoa_don_select", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new SqlParameter("@Hoa_don_id",hoaDon.Text));
        da = new SqlDataAdapter(cmd);
        ds = new DataSet();
        da.Fill(ds, "Hoa_don");
        gv.DataSource = ds.Tables["Hoa_don"];
        gv.DataBind();
    }
}